package com.tx.springboot_demo.config;

import com.tx.springboot_demo.filter.InputFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ：tx
 * @description： filter配置类
 * @date ：Created in 2019/4/3 15:40
 * @modified By：
 * @version:
 */
@Configuration
public class InputConfig  {

    @Bean
    public FilterRegistrationBean filterRegistrationBean(){
        FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
        filterRegistrationBean.setFilter(new InputFilter());
        List<String> chain = new ArrayList<>();
        chain.add("/hello");
        filterRegistrationBean.setUrlPatterns(chain);
        return filterRegistrationBean;
    }

}
